<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>方剂-自拟</title>
</head>
<body>
<div id="constructedPrescriptions-plan"></div>
</body>
</html>
<script>
 var formConstructedPrescriptions = new Ext.form.FormPanel({
        baseCls: 'x-plain',
        applyTo: 'constructedPrescriptions-plan',
        labelWidth: '100%',
        height:200,
        isFormField:true,
        url:'',
        defaultType: 'textfield',
        items: [
       		new Ext.form.Checkbox({boxLabel:'是否同异名扩展',hideLabel:true}),{
            xtype: 'textarea',
            hideLabel: true,
            name: 'msg',
            id:'constructedPrescriptionsName',
            anchor: '100% -10'  // anchor width by percentage and height by raw adjustment
        }],
        buttons: [{
            text: '查询',
            handler: function (){
            	if(formConstructedPrescriptions.getComponent('constructedPrescriptionsName').getValue() == '')
            		return ;
            	Ext.Ajax.request({
				   url: basePath+'/../prescription',
				   method: 'post',
				   success: constructedPrescriptionsSomeFn,
				   failure: constructedPrescriptionsotherFn,
				   headers: {
				       'my-header': 'foo'
				   },
				   params: { doClass: 'constructedPrescriptions',constructed:formConstructedPrescriptions.getComponent('constructedPrescriptionsName').getValue() }
				});
            }
        }]
        
    });
function constructedPrescriptionsSomeFn(e){
	var o = eval("["+e.responseText+"]");
	if(o[0].id < 0){
		alert(o[0].mes);
	}else{
		var ar = new Array();
		ar[0] = {data:{id:o[0].id}};
		selectPreRecord(ar);
	}
}
function constructedPrescriptionsotherFn(){
alert('自拟查询错误!');
}
</script>